package com.h2cloud.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author: wulongkai
 * @create: 2022-10-20 10:52
 **/
@RestController
@RequestMapping("/apiTest")
public class ApiController {

    // http://127.0.0.1:8082/medicalhelper/aopTest/sayHi/andya
    @RequestMapping(value = "/v5", method = RequestMethod.GET)

    public Res sayHi() {
        System.out.println("say");
//        Res res = new Res();
//        res.setName("longkai");
//        res.setAge(21);
//        res.setKvs(null);
        List<kv> lists = new ArrayList<>();
        lists.add(new kv("key1", "value1"));
        lists.add(new kv("key2", "value2"));

        System.out.println(lists);
        System.out.println(Arrays.toString(new List[]{lists}));

        Res res = Res.builder()
                .name("longkai")
                .age(12)
                .kvs(lists)
                .build();
        return res;
    }
}